//
// Created by 11510 on 2024/6/24.
//
#include <iostream>
#include <vector>
using std::cout;
using std::endl;
using std::vector;

void test0(){
//    初始化
//    1. 无参对象
    vector<int> number1;
//    2. 传count个value
    vector<int> number2(10, 8);
    for(size_t idx = 0; idx != number2.size(); idx++){
        cout << number2[idx] << " ";
    }
//    3. 传迭代器范围的元素
    int array[] = {3, 2, 5, 8, 4, 7, 6, 9};
    vector<int> number3(array, array + 8);

    /**
     * begin()指向第一个元素
     * end()指向最后一个元素的下一位
     */
    for (vector<int>::iterator it = number3.begin(); it != number3.end() ; ++it) {
        cout << *it << " ";
    }

    for (auto& elem: number3) {
        cout << elem << " ";
    }

}


int main() {
    test1();
    return 0;
}